﻿@model FreightSoft.Models.ORDER_LINE

@{
    FreightSoft.Models.Entities db = new FreightSoft.Models.Entities();
    string part = db.PARTs.Max(p => p.PART_ID) + 1 + "";
}

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>



@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Order Line</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.ORDER_ID, "Customer Order")
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.ORDER_ID, new { @readonly="readonly", Value = this.ViewContext.RouteData.Values["id"] })
            @Html.ValidationMessageFor(model => model.ORDER_ID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PART_ID, "Part No")
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.PART_ID)
            @Html.ValidationMessageFor(model => model.PART_ID)
            <button type="button" class="btn btn-link" onclick='window.open("http://localhost:55882/Part/Create", "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=200, left=500, width=400, height=400");
                document.getElementById("PART_ID").value = @part;'>New Part...</button>
        </div>

        

        <div class="editor-label">
            @Html.LabelFor(model => model.QUANTITY)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.QUANTITY)
            @Html.ValidationMessageFor(model => model.QUANTITY)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}